<?php
/**
 * Response Method
 * 
 * @package util
 * @author wangzhiliang
 *
 */
class Response
{
    /**
     * 设置响应头的ContentType
     *
     * @param string $charSet
     * @param string $type
     */
    public static function sendContentType ($charSet = 'utf-8', $type = 'text/html')
    {
        if (! headers_sent()) {
            header("Content-Type:{$type}; charset={$charSet}");
        }
    }
    /**
     * 服务端跳转
     *
     * @param string $url
     * @param int $code
     */
    public static function redirect ($url, $code = 302)
    {
        if ($code == 301) {
            Header('HTTP/1.1 301 Moved Permanently');
        }
        header('Location: ' . $url);
        exit();
    }
}